<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- 引包 -->
    <script src="../js/vue.js"></script>
</head>

<body>
    <!-- 容器|模板 -->
    <div id="app">
        <!-- //v-for可以遍历以下数据:数组、数字、字符串、对象 -->
        <!--遍历数组 -->
        <ul>
            <li v-for="(item,index) in apple" :key="item.id">{{item.name}}</li>
        </ul>

        <!-- 遍历数字 -->
        <p v-for="(item,index) in 3" :key="item.index">{{item}}</p>

        <!-- 遍历字符串 -->
        <p v-for="(item,index) in '明天吃什么'" :key="item.index">{{item}}</p>

        <!-- 遍历对象 -->
        <p v-for="(item,index) in apple2" :key="item.index">{{item}}={{index}}</p>
    </div>
</body>

</html>
<script>
    //关联VM
    const VM = new Vue({
        el: '#app',
        data:{
            apple:[
                {id:1,name:'xiaohong'},
                {id:2,name:'xiaohong'},
                {id:3,name:'xiaohong'},
            ],
            apple2:{
                name:111,
                age:1111
            }
        }
    })
</script>